<template>
	<view class="enterpriseInformation">
		<view class="enterpriseTitle">企业信息</view>
		<view class="enterprise">
			<view class="header flex">
				<divImg class="logo" :src="fromData.logo" mode=""></divImg>
				<view class="box spaceBetween">
					<view class="name">
						{{ fromData.name }}
					</view>
					<view class="profession">
						{{ fromData.profession }}
					</view>
				</view>
			</view>
			<view class="title">宣传视频</view>
			<video class="promotional_video" :src="fromData.promotional_video" controls></video>
			<view class="title">企业风采</view>
			<view class="picList">
				<view class="item" v-for="(i, index) in fromData.images">
					<image class="itemPic" @click="previewImage(fromData.images, index)" :src="i" mode="aspectFill"></image>
				</view>
			</view>
			<view class="title">核心产品</view>
			<view class="picList">
				<view class="item" v-for="(i, index) in fromData.product">
					<image class="itemPic" @click="product(index)" :src="i.product_img[0]" mode="aspectFill"></image>
					<view class="product_name ellipsis">
						{{ i.product_name }}
					</view>
					<view class="product_desc ellipsis">
						{{ i.product_desc }}
					</view>
				</view>
			</view>
			<view class="title">相关文档</view>

			<view class="wpsList" v-for="(i, index) in fromData.wps">
				<view class="name ellipsis">
					{{ i }}
				</view>
				<view class="btn" @click="down(i)">下载</view>
			</view>
		</view>
	</view>
</template>

<script>
	
	export default {
		name: 'enterpriseInformation',
		props: {
			fromData: {
				type: Object,
				default: () => {},
			},
		},
		data() {
			return {};
		},
		methods: {
			down(wps){
				// uni.downloadFile({
				// 	url: wps,
				// 	success: (res) => {
				// 		console.log(res)
				// 	}
				// });
				// window.location.href=wps;
				window.open(wps+'?t='+new Date())
			},
			product(index){
				uni.setStorageSync('productItem',this.fromData)
				uni.navigateTo({
					url:"/pages/group/product/product?index="+index
				})
			},
			previewImage(list, index) {
				list = JSON.parse(JSON.stringify(list));
				if (list[index].product_img) {
					for (let i in list) {
						list[i] = list[i].product_img[0];
					}
				}
				uni.previewImage({
					urls: list,
					current: index,
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	.enterpriseInformation {
		margin: 0 auto;
		overflow: hidden;
		width: 690rpx;
		.enterpriseTitle {
			font-weight: bold;
			color: #000000;
			font-size: $uni-font-size-15;
			margin-bottom: 20rpx;
		}
		.enterprise {
			width: 690px;
			overflow: hidden;
			background: #ffffff;
			border-radius: $margin-width;

			.header {
				overflow: hidden;
				.logo {
					margin-top: 35rpx;
					margin-left: 20rpx;
					width: 80rpx;
					height: 80rpx;
					border-radius: 50%;
					overflow: hidden;
				}
				.box {
					flex-direction: column;
					margin-left: 20rpx;
					margin-top: 35rpx;
					.name {
						font-weight: bold;
						color: #000000;
						font-size: $uni-font-size-15;
					}
					.profession {
						color: #999999;
						font-size: $uni-font-size-12;
					}
				}
			}
			.title {
				width: 650rpx;
				color: #999999;
				font-size: $uni-font-size-12;
				margin: $margin-width $submargin-width $submargin-width;
			}
			.promotional_video {
				width: 650rpx;
				height: 300rpx;
				margin: 0 auto;
			}
			.picList {
				width: 670rpx;
				overflow: hidden;
				.item {
					width: 200rpx;
					// height: 150rpx;
					float: left;
					margin-left: 20rpx;
					margin-bottom: 20rpx;
					overflow: hidden;
					.itemPic {
						width: 200rpx;
						height: 150rpx;
					}
					.product_name {
						color: #000000;
						font-size: $uni-font-size-12;
						margin: 6rpx 0;
					}
					.product_desc {
						color: #999999;
						font-size: $uni-font-size-10;
					}
				}
			}
			.wpsList {
				height: 80rpx;
				display: flex;
				justify-content: space-between;
				width: 650rpx;
				line-height: 80rpx;
				margin-left: 20rpx;
				align-items: center;
				// margin: 0 auto;
				overflow: hidden;
				border-bottom: 1rpx solid #DDDDDD;
				.name {
					width: 500rpx;
					color: #000000;
					font-size: $uni-font-size-12;
					
				}
				.btn {
					padding: 0 15rpx;
					height: 40rpx;
					background: $price-color;
					border-radius: 28rpx;
					color: #ffffff;
					font-size: $uni-font-size-10;
					line-height: 40rpx;
					width: auto;
				}
				&:last-child {
					border-bottom: none;
				}
			}
		}
	}
</style>
